function y=likelihood(Beta, Data)

%This is a function to set up the logit likelihood

option=max(Data(:,3));
L=size(Data,2)-4+option-1;
%xn=Data((n-1)*40+1:n*40,:);
xn=Data;
y=1;
for t=1:10
    xt=[eye(option-1) xn((t-1)*option+1:t*option-1,5:5+L-option)];
    xt(option,:)=zeros(1,L);
    choice=xn((t-1)*option+1:t*option,4);
    
    numer=exp(xt*Beta');
    if min(choice)==1
        y=y*numer(choice==1)/sum(numer);
    end
end